import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("card_no", ["cardNo"], { unique: true })
@Entity("charge_card", { schema: "cabinet" })
export class ChargeCard {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("int", {
    name: "user_id",
    comment: "用户id",
    unsigned: true,
    default: () => "'0'",
  })
  userId: number;

  @Column("varchar", {
    name: "card_no",
    unique: true,
    comment: "卡号",
    length: 20,
  })
  cardNo: string;

  @Column("decimal", {
    name: "amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  amount: string;

  @Column("decimal", {
    name: "reward_amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  rewardAmount: string;

  @Column("tinyint", { name: "status", unsigned: true, default: () => "'0'" })
  status: number;
}
